package cn.nexd.collector.core;

import android.content.Context;
import android.content.pm.PackageManager;

import cn.nexd.collector.NexdCollectorConfiguration;
import cn.nexd.collector.listener.CollectorListener;

/**
 * Created by codngfish on 16/5/16.
 */
public abstract class Collector implements ICollector {

    protected Context context;
    protected NexdCollectorConfiguration collectorConfiguration;
    protected CollectorListener collectorListener;
    protected boolean collectorRunning = false;

    protected Collector(Context context, NexdCollectorConfiguration collectorConfiguration, CollectorListener collectorListener) {
        this.context = context;
        this.collectorConfiguration = collectorConfiguration;
        this.collectorListener = collectorListener;
    }

    protected boolean checkPermission(String permission) {
        int res = context.checkCallingOrSelfPermission(permission);
        return (res == PackageManager.PERMISSION_GRANTED);
    }

    public abstract boolean permssion();
}
